<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">发送推送消息</ui:define>
    <ui:define name="content">
        <h:form>

            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar id="buttonToolBar">
                    <f:facet name="right">
                        <p:commandButton
                                actionListener="#{sendPushMessageBean.onSend}"
                                icon="fa fa-bullhorn"
                                value="发送"
                                update="@form">
                            <p:confirm header="提示信息" message="确定发送?" icon="ui-icon-alert"/>
                        </p:commandButton>
                        <p:button value="返回" icon="fa fa-reply-all"
                                  outcome="/views/family/user-info/send-sms/calculate-sms.xhtml"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">

                    <div class="ui-g-12">
                        <div class="card ui-g-12">
                            <div class="ui-g-1">
                                <p:outputLabel value="任务名称"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-5">
                                <p:inputText value="#{sendPushMessageBean.$.taskName}" disabled="#{sendPushMessageBean.isView()}"/>
                            </div>

                            <div class="ui-g-2">
                                <p:outputLabel value="发送时间"/>
                            </div>
                            <div class="ui-g-4">
                                <p:calendar value="#{sendPushMessageBean.$.sendTime}"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATETIME_FORMAT')}"
                                            readonlyInput="true"
                                            disabled="#{sendPushMessageBean.isView()}"/>
                            </div>
                        </div>
                    </div>


                    <div class="ui-g-12">
                        <div class="card ui-g-12">

                            <div class="ui-g-1">
                                <p:outputLabel value="推送通道"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-5">
                                <p:selectOneMenu id="pushChannel" value="#{sendPushMessageBean.$.pushChannel}"
                                                 filter="true"
                                                 filterMatchMode="contains"
                                                 disabled="#{sendPushMessageBean.isView()}">
                                    <f:selectItem itemLabel="请选择" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{sendPushMessageBean.dictionaries[DictionaryCode.PUSH_MESSAGE_CHANNEL]}"
                                            var="dic"
                                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                </p:selectOneMenu>
                            </div>

                            <div class="ui-g-1">
                                <p:outputLabel value="发送人群"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-5">
                                <p:selectOneMenu id="userGroup" value="#{sendPushMessageBean.$.userGroup}"
                                                 filter="true"
                                                 filterMatchMode="contains"
                                                 disabled="#{sendPushMessageBean.isView()}">
                                    <f:selectItem itemLabel="请选择" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{sendPushMessageBean.dictionaries[DictionaryCode.PUSH_MESSAGE_USER_GROUP]}"
                                            var="dic"
                                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                </p:selectOneMenu>
                            </div>

                            <div class="ui-g-1">
                                <p:outputLabel for="productId" value="产品"/>
                            </div>
                            <div class="ui-g-5">
                                <p:selectCheckboxMenu label="-请选择-" id="productId" value="#{sendPushMessageBean.$.productIds}"
                                                      updateLabel="true"
                                                      multiple="true"
                                                      filter="true"
                                                      disabled="#{sendPushMessageBean.isView()}">
                                    <f:selectItems
                                            value="#{sendPushMessageBean.getCommProductIds()}"
                                            var="product"
                                            itemLabel="#{product.name}" itemValue="#{product.productId}"/>
                                </p:selectCheckboxMenu>
                            </div>

                        </div>
                    </div>

                    <div class="ui-g-12">
                        <div class="card ui-g-12">

                            <div class="ui-g-1">
                                <p:outputLabel value="Logo图"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-11">
                                <div class="ui-g-12 ui-g-nopad">
                                    <div class="ui-g-5 ui-g-nopad">
                                        <p:fileUpload
                                                fileUploadListener="#{sendPushMessageBean.uploadImage}"
                                                mode="advanced"
                                                update="@this"
                                                process="@this"
                                                auto="true" sizeLimit="#{constants:get('UPLOAD_FILE_SIZE')}"
                                                allowTypes="/(\.|\/)(#{constants:get('UPLOAD_FILE_SUFFIX')})$/"
                                                label="上传"
                                                invalidFileMessage="不支持上传文件类型"
                                                invalidSizeMessage="文件过大"
                                                disabled="#{sendPushMessageBean.isView()}"/>

                                    </div>

                                    <div class="ui-g-2"></div>

                                    <div class="ui-g-5 ui-g-nopad">
                                        <p:graphicImage id="image"
                                                        value="#{sendPushMessageBean.$.icon}"
                                                        width="40px"/>
                                    </div>
                                </div>
                            </div>


                            <div class="ui-g-1">
                                <p:outputLabel value="消息标题"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-5">
                                <p:inputText value="#{sendPushMessageBean.$.title}" disabled="#{sendPushMessageBean.isView()}"/>
                            </div>

                            <div class="ui-g-1">
                                <p:outputLabel value="消息内容"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-5">
                                <p:inputText value="#{sendPushMessageBean.$.content}" disabled="#{sendPushMessageBean.isView()}"/>
                            </div>
                            
                             <div class="ui-g-1">
                                <p:outputLabel value="跳转链接"/>
                                 <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-5">
                                <p:inputText value="#{sendPushMessageBean.$.htmlUrl}" disabled="#{sendPushMessageBean.isView()}">
                                </p:inputText>
                            </div>

                        </div>
                    </div>


                    <div class="ui-g-12">
                        <div class="card ui-g-12">

                            <div class="ui-g-1">
                                <p:outputLabel value="展示方式"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-5">
                                <p:selectOneMenu id="showType" value="#{sendPushMessageBean.$.showType}"
                                                 filter="true"
                                                 filterMatchMode="contains"
                                                 disabled="#{sendPushMessageBean.isView()}">
                                    <f:selectItem itemLabel="请选择" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{sendPushMessageBean.dictionaries[DictionaryCode.PUSH_MESSAGE_SHOW_TYPE]}"
                                            var="dic"
                                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                </p:selectOneMenu>
                            </div>

                            <div class="ui-g-1">
                                <p:outputLabel value="通知方式"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-5">
                                <p:selectOneMenu id="notifyType" value="#{sendPushMessageBean.$.notifyType}"
                                                 filter="true"
                                                 filterMatchMode="contains"
                                                 disabled="#{sendPushMessageBean.isView()}">
                                    <f:selectItem itemLabel="请选择" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{sendPushMessageBean.dictionaries[DictionaryCode.PUSH_MESSAGE_NOTIFY_TYPE]}"
                                            var="dic"
                                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                </p:selectOneMenu>
                            </div>

                            <div class="ui-g-1">
                                <p:outputLabel value="响应方式"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-5">
                                <p:selectOneMenu id="responseType" value="#{sendPushMessageBean.$.responseType}"
                                                 filter="true"
                                                 filterMatchMode="contains"
                                                 disabled="#{sendPushMessageBean.isView()}">
                                    <f:selectItem itemLabel="请选择" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{sendPushMessageBean.dictionaries[DictionaryCode.PUSH_MESSAGE_RESPONSE_TYPE]}"
                                            var="dic"
                                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                </p:selectOneMenu>
                            </div>

                        </div>
                    </div>

                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>